package com.zhao.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

/**
 * 工具类
 * @author zhaowj
 * @date2018年1月21日 下午1:05:58
 */
public class CommonUtil {
	
	public static Map<String,String> readValue(String filePath,String[] array) {   
        Properties props = new Properties();   
        InputStream in=CommonUtil.class.getClass().getResourceAsStream(filePath);
        Map<String,String> map=new HashMap<String,String>();
        try {   
            props.load(in);
          
            for(String key:array) {
            	map.put(key, props.getProperty(key));
            }
           
            return map;   
        } catch (Exception e) {   
            e.printStackTrace();   
            return map;   
        } finally {
			try {
				in.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}  
    } 
}
